# 角色页面管理
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class RoleManager(KeyWords):
    url = KeyWords.url + 'roles'

    # 新建部门
    def create_role(self):
        '''
        现建角色
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\role_manager\create_role.yaml')
        element_operation(self, data[0]['data'])

    def role_list(self):
        '''
        角色列表
        :return:
         '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\role_manager\role_list.yaml')
        element_operation(self, data[0]['data'])

    def role_detail_and_update(self):
        '''
        查看角色详情和修改角色
        :return:
         '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\role_manager\role_detail_and_update.yaml')
        element_operation(self, data[0]['data'])

    def role_open_and_delete(self):
        '''
        启用角色并删除角色
        :return:
         '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\role_manager\role_open_and_delete.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    driver = choose_browser()
    L = LonginPage(driver)
    L.login('kobeAdmin002', 'kobe8888')
    case = RoleManager(driver)
    case.role_open_and_delete()
